package com.example.dicos.util;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * java 校验手机号
 */
@Slf4j
public class PathResource {
    private static final Logger logger = LoggerFactory.getLogger(PathResource.class);

    public static boolean isMobileNO(String mobiles) {

        Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");

        Matcher m = p.matcher(mobiles);

        logger.info("手机号={} | 校验结果={}", mobiles, m);

        return m.matches();
    }
}
